package org.example.registry;

import org.example.config.RegistryConfig;
import org.example.model.ServiceMetaInfo;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @Title: Registry
 * @Author: kunliangzhao
 * @Package org.example.registry
 * @Date: 2025/6/12 11:23
 * @Description: 注册中心
 */
public interface Registry {

    /**
     * 初始化
     * @param registryConfig
     */
    void init(RegistryConfig registryConfig);


    /**
     * 注册服务
     * @param serviceMetaInfo
     * @throws Exception
     */
    void register(ServiceMetaInfo serviceMetaInfo) throws Exception;


    /**
     * 移除服务
     * @param serviceMetaInfo
     */
    void unRegister(ServiceMetaInfo serviceMetaInfo);

    /**
     * 服务发现
     * @param serviceKey
     * @return
     */
    List<ServiceMetaInfo> serviceDiscovery(String serviceKey);

    /**
     *  销毁
     */
    void destroy();

    /**
     * 心跳检测
     */
    void heartBeat();


    /**
     * 监听服务节点
     * @param serviceNodeKey
     */
    void watch(String serviceNodeKey);
}
